//app.js
const amap = require('utils/amap-wx.js')
const util = require('utils/util.js')
const key  = require('key.js')

App({
  onLaunch: function () {
     let date_ = util.formatDate(new Date())
     console.log(date_)
     this.globalData.date = date_
     wx.getSystemInfo({
        success: e => {
           this.globalData.StatusBar = e.statusBarHeight;
           let custom = wx.getMenuButtonBoundingClientRect();
           this.globalData.Custom = custom;
           this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
           console.log(custom)
        }
     })
     let aMap = new amap.AMapWX({ key: key.mapKey})
      
     aMap.getWeather({
        success:res=>{
           console.log(res)
           this.globalData.weather = res.liveData
           if(this.weatherCallBack){
              this.weatherCallBack(res)
           }
        },
        fail:err=>{
           console.log(err)
        }
     })

     
    
  },
  globalData: {
    userInfo: null,
    date:'',
    weather:''
  },
  
})